/**
 * @file shell_port.c
 */

#include "shell_port.h"

Shell shell;//创建一个Shell对象
char Shell_Buf[128] = {0};//给shell设置一个缓存区


signed short userShellWrite(char *data, unsigned short len)
{
    /*通过Shell发送一串数据*/
    for(int32_t i=0; i< len; i++)
    {
        usart_data_transmit(USART1, (uint8_t) *data++);
        while(RESET == usart_flag_get(USART1, USART_FLAG_TBE));
    }
    /*返回写如的数据长度（字节）*/
    return len;
}

/**
 * @brief 用户shell初始化
 *
 */
void userShellInit(void)
{
    shell.write = userShellWrite;
    shellInit(&shell,Shell_Buf,sizeof(Shell_Buf));
}
